/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2011 All Rights Reserved.
 */
package com.liwei.nio.mina;

import java.nio.charset.Charset;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

/**
*
* @author lidian
* @version $Id: MyProtocalCodecFactory.java, v 0.1 2011-1-27 上午10:10:45 lidian Exp $
*/
public class MyProtocalCodecFactory implements ProtocolCodecFactory {
    private final MyProtocalEncoder encoder;
    private final MyProtocalDecoder decoder;

    public MyProtocalCodecFactory(Charset charset) {
        encoder = new MyProtocalEncoder(charset);
        decoder = new MyProtocalDecoder(charset);
    }

    public ProtocolEncoder getEncoder(IoSession session) {
        return encoder;
    }

    public ProtocolDecoder getDecoder(IoSession session) {
        return decoder;
    }

}
